home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
pctj8406.arc
/
RANGE.PRG
< prev
next >
Wrap
Text File
|
1986-09-14
|
3KB
|
69 lines
SET TALK OFF
ERASE
* - Validate the temperature in degrees Fahrenheit
* - initially, the condition "valid" is not true
STORE f TO valid
* - initialize memvar for the temperature
STORE 0000.0 TO todaystemp
* - the loop repeats until a valid temperature is entered
DO WHILE (.not. valid)
CLEAR GETS
@ 10,10 SAY "Please enter today's temperature "
* - "todaystemp" is a numeric memvar
@ 10,$+2 GET todaystemp PICTURE "9999.9"
@ 10,$+2 SAY "degrees Fahrenheit"
READ
CLEAR GETS
* - erase any old error message from line 11
@ 11, 0
* - this is the actual range check
IF ( ( todaystemp < -99 ) .or. ( todaystemp > 150 ) )
* - if the number is out of range, put out the message,
* - surround it with blinking arrows, and ring the bell
@ 11, 17 SAY "Wild weather! Please check that temperature."
* - on an IBM PC, these color numbers cause blinking
SET COLOR TO 120,158
@ 11, $+2 SAY "<<<<<"
@ 11, 11 SAY ">>>>>"
* - reset to normal colors
SET COLOR TO 120,7
* - ring the bell (or beep)
?? CHR(7)
ELSE - range check passed
* - the temperature input is valid
STORE t TO valid
ENDIF - range check
ENDDO - while not valid
RELEASE valid
QUIT
***